package com.example.entity;

import com.example.common.Add;
import com.example.common.Update;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@Data
public class Person {

    @NotNull(message = "姓名不能为空",groups = {Add.class})
    String name;

    @Valid
    @NotNull(message = "personList不能为空")
    @Size(min = 1, message = "personList至少有一个对象")
    List<Address> personList;

    @NotNull(message = "年龄不能为空",groups = {Update.class})
    Integer age;
}
